﻿@model WebTech.Coursework02.Models.LoginModel

@* namespaces needed to access BotDetect members and the CaptchaHelper class *@
@using BotDetect.Web.UI.Mvc;
@using  WebTech.Coursework02.Utilities;

@{
    ViewBag.Title = "Log in";
}
@* include BotDetect layout stylesheet in page <head> *@
<br />
<hgroup class="title">
    <h1>@ViewBag.Title.</h1>
</hgroup>
<section id="search" style="float:right">
    <span class="k-textbox k-space-right" style="width:300px">
        <input id="txtSearch" type="text" style="width:270px"/>
        <a class="k-icon k-i-search" href="#"></a>
    </span>
</section>
<br />

 
<section id="loginForm">

    @using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary()

        @functions {
     object getHtmlAttributes (bool ReadOnly, string CssClass) 
     {
         if (ReadOnly) {
             return new { @class = CssClass, @readonly = "readonly" };
         }
         return new { @class = CssClass };
     }
    }

    <fieldset>
        <legend>Log in Form</legend>
        <ol>
            <li>
                @Html.LabelFor(m => m.UserName)
                @Html.TextBoxFor(m => m.UserName, new { id = "txtbxUserName"})
                @Html.ValidationMessageFor(m => m.UserName)
            </li>
            <li>
                @Html.LabelFor(m => m.Password)
                @Html.PasswordFor(m => m.Password, new { id = "txtbxPassword"})
                @Html.ValidationMessageFor(m => m.Password)
            </li>
            <li>
                @Html.CheckBoxFor(m => m.RememberMe)
                @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" })
            </li>
           <li>
                @Html.Label("CaptchaCode", "Retype the code from the picture:")
                @{ MvcCaptcha sampleCaptcha = CaptchaHelper.GetSampleCaptcha(); }
                @Html.Captcha(sampleCaptcha)
           </li>
             <li>
                @Html.TextBox("CaptchaCode")
                <span class="status" id="status">Not checked yet</span>
               @* <a href="#" id="check">Check</a>*@
             <li>
        </ol>
        <input type="submit" value="Log in" id="sumbitButton" class="k-button k-button-icontext"/>
    </fieldset>
            
    <p>
        @Html.ActionLink("Register", "Register") if you don't have an account.
    </p>
}
</section>